package nc.bs.pub.action;

import nc.bs.common.projectFAUtils;
import nc.bs.framework.common.NCLocator;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.itf.pu.m21.IOrderMaintain;
import nc.vo.pu.m21.context.OrderContext;
import nc.vo.pu.m21.entity.OrderVO;
import nc.vo.pu.m21.pub.OrderContextUtil;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class N_21_SAVEBASE extends AbstractCompiler2 {
	public String getCodeRemark() {
		return " nc.vo.pu.m21.entity.OrderVO[] inObject =\n          (nc.vo.pu.m21.entity.OrderVO[]) this.getVos();\n      nc.vo.pu.m21.context.OrderContext[] ctxs =\n          nc.vo.pu.m21.pub.OrderContextUtil.getCtxs(vo);\n      nc.vo.pu.m21.context.OrderContext ctx = null;\n      if (ctxs != null) {\n        ctx = ctxs[0];\n      }\n      return nc.bs.framework.common.NCLocator.getInstance()\n          .lookup(nc.itf.pu.m21.IOrderMaintain.class).save(inObject, ctx);\n";
	}

	public Object runComClass(PfParameterVO vo) throws BusinessException {
		try {
			super.m_tmpVo = vo;
			OrderVO[] inObject = (OrderVO[]) ((OrderVO[]) this.getVos());
			OrderContext[] ctxs = OrderContextUtil.getCtxs(vo);
			OrderContext ctx = null;
			if (ctxs != null) {
				ctx = ctxs[0];
			}
			
			//lhw 231128 保存前校验项目begin
			new projectFAUtils().projectDataApprove("po_order", inObject, "save");
			//end

			return ((IOrderMaintain) NCLocator.getInstance().lookup(IOrderMaintain.class)).save(inObject, ctx);
		} catch (Exception var5) {
			ExceptionUtils.marsh(var5);
			return null;
		}
	}
}